<div id="admin-detail" class='bc-detail' style='max-width: 450px;'>
	<div>
		<div class='weui-flex-center weui-flex-center-xs' style="padding:15px;">
			<headimgurl detail=i><img class='headimg' /></headimgurl>
			<user_name id="admin-user-name" detail=1></user_name>&nbsp;
			<small mute>#<user_id id="admin-detail-user-id" detail=1></user_id> <class_name detail=1></class_name>管理员</small>
			<admin_id detail=1 id="admin-id" class='hidden'></admin_id>
		</div>
	</div>
	<div class='weui-cells__title'>安全控制</div>
	<div class="weui-cells weui-cells_form">
		<div class="weui-cell weui-cell_switch">
			<div class="weui-cell__hd">
				<i class="i i-crownfill"></i>&nbsp;
			</div>
			<div class="weui-cell__bd" style='flex: 2;color:#666'>
				<class_name detail=1></class_name>高级
			</div>
			<div class="weui-cell__bd" style="text-align:right;"><small mute><ultimate_admin_name detail="1"></ultimate_admin_name></small>&nbsp;</div>
			<div class="weui-cell__ft" style='width:52px;text-align: center;'>
				<input autocomplete='off' id="admin-switch-ultimate" class="weui-switch weui-switch_warn" detail="1" name="ultimate" type="checkbox">
			</div>
		</div>
		<div class="weui-cell weui-cell_switch">
			<div class="weui-cell__hd">
				<i class="i i-lockfill"></i>&nbsp;
			</div>
			<div class="weui-cell__bd" style='flex: 2;color:#666'>
				封锁
			</div>
			<div class="weui-cell__bd" style="text-align:right;"><small mute=""><seal_admin_name detail="1"></seal_admin_name></small>&nbsp;</div>
			<div class="weui-cell__ft" style='width:52px;text-align: center;'>
				<input autocomplete='off' id="admin-switch-seal" class="weui-switch weui-switch_danger" detail="1" name="seal" type="checkbox">
			</div>
		</div>
		<div class="weui-cell">
			<div class="weui-cell__hd">
				<i class="i i-tagfill"></i>&nbsp;
			</div>
			<div class="weui-cell__hd" style=';color:#666'>
				备注姓名
			</div>
			<div class="weui-cell__bd">
				<input autocomplete='off' class='weui-input' name='user_name' detail="1" placeholder="设置备注姓名" id='admin-set-name'/>
			</div>
		</div>
	</div>
	<div class="weui-cells__title">基本信息</div>
	<div class="weui-cells">
		<div class="weui-cell">
			<div class="weui-cell__hd">
				<label class="weui-label">手机号码</label>
			</div>
			<div class="weui-cell__bd"></div>
			<div class="weui-cell__ft">
			<tel detail="1"></tel>
			</div>
		</div>
		<div class="weui-cell">
			<div class="weui-cell__hd">
				<label class="weui-label">邮箱</label>
			</div>
			<div class="weui-cell__bd"></div>
			<div class="weui-cell__ft">
				<email detail="1"></email>
			</div>
		</div>
		<div class="weui-cell">
			<div class="weui-cell__hd">
				<label class="weui-label">添加人</label>
			</div>
			<div class="weui-cell__bd"></div>
			<div class="weui-cell__ft">
				<creator_name detail="1"></creator_name>
			</div>
		</div>
		<div class="weui-cell">
			<div class="weui-cell__hd">
				<label class="weui-label">添加时间</label>
			</div>
			<div class="weui-cell__bd"></div>
			<div class="weui-cell__ft">
				<create_time detail="1"></create_time>
			</div>
		</div>
	</div>
	<div class="weui-btn-area">
		<div class="weui-btn weui-btn_warn" id="admin-detail-remove">
			删除<class_name detail=1></class_name>管理员:<user_name detail=1></user_name>
		</div>
	</div>
	<br/>
</div>
<sss>
<!-- delete admin_control_init; -->
<!-- if(typeof(admin_control_init)!='undefined') admin_control_init.remove(); -->
admin_control_init = function (){
	var admin_id,user_id;
	POST.init('#admin-detail-remove',{
		stop:function(){
			var admin_id = $("#admin-id").text();
			if(!admin_id){
				return true;
			}
		},
		input:function(){
			var admin_id = $("#admin-id").text();
			return {admin_id:admin_id}
		},
		text:"删除",
		confirm:function(){
			var target = $("#admin-user-name").text();
			return {target:target}
		},
		success:function(){
			if(ISMOBILE()){
				history.back();
			}else{
				$('#admin-setting-pc').fadeOut(200,function(){
					$('#admin-setting-pc').html('');
				})
			}
			LIST.reload('#admin-list');
		},
		url:'http://api.hongyanche.com/admin/remove'
	})
	POST.init('#admin-switch-ultimate',{
		style:'input',
		method:'change',
		stop:function(){
			admin_id = $("#admin-id").text();
			if(!admin_id){
				return true;
			}
		},
		input:function(e){
			var ultimate = $(e).prop("checked")?1:0 
			return {admin_id:admin_id,ultimate:ultimate}
		},
		success:function(){
			LIST.reload('#admin-list');
			$("#admin-detail ultimate_admin_name").html($('#local-user-name').html())
		},
		url:'http://api.hongyanche.com/admin/ultimate'
	})
	POST.init('#admin-switch-seal',{
		style:'input',
		method:'change',
		stop:function(){
			admin_id = $("#admin-id").text();
			if(!admin_id){
				return true;
			}
		},
		input:function(e){
			var seal = $(e).prop("checked")?1:0 
			return {admin_id:admin_id,seal:seal}
		},
		success:function(){
			LIST.reload('#admin-list');
			$("#admin-detail seal_admin_name").html($('#local-user-name').html())
		},
		url:'http://api.hongyanche.com/admin/seal'
	})

	POST.init('#admin-set-name',{
		style:'input',
		method:'change',
		stop:function(){
			user_id = $("#admin-detail-user-id").text();
			if(!user_id) return true;
		},
		input:function(){
			var newname = $('#admin-set-name').val();
			return {newname:newname,user_id:user_id}
		},
		success:function(){
			LIST.reload('#admin-list');
			if($('#admin-set-name').val()){
				$('#admin-user-name').text($('#admin-set-name').val());
			}
		},
		url:'http://api.hongyanche.com/admin/set_name'
	})
}
admin_control_init();
setTimeout(function(){
	if(!$('#admin-id').text()) window.home()
},100)
</sss>
